package service

import (
	"context"
	"ruoyi-go-echo-ddd/internal/domain/model"
	"ruoyi-go-echo-ddd/internal/domain/repository"
	"ruoyi-go-echo-ddd/internal/infrastructure/http/request"
)

type SysUserRoleService struct {
	repo repository.SysUserRoleRepository
}

func NewSysUserRoleService(repo repository.SysUserRoleRepository) *SysUserRoleService {
	return &SysUserRoleService{
		repo: repo,
	}
}

func (s *SysUserRoleService) Insert(ctx context.Context, sysUserRole *model.SysUserRole) (*model.SysUserRole, error) {
	return s.repo.Insert(ctx, sysUserRole)
}

func (s *SysUserRoleService) Update(ctx context.Context, sysUserRole *model.SysUserRole) (int64, error) {
	return s.repo.Update(ctx, sysUserRole)
}

func (s *SysUserRoleService) BatchInsert(ctx context.Context, list []*model.SysUserRole) ([]int64, error) {
	return s.repo.BatchInsert(ctx, list)
}

func (s *SysUserRoleService) SelectById(ctx context.Context, id int64) (*model.SysUserRole, error) {
	return s.repo.SelectById(ctx, id)
}

func (s *SysUserRoleService) SelectPage(ctx context.Context, param *request.CommonPageParam) ([]*model.SysUserRole, int64, int64, error) {
	return s.repo.SelectPage(ctx, param)
}

func (s *SysUserRoleService) BatchDelete(ctx context.Context, ids []any) (int64, error) {
	return s.repo.BatchDelete(ctx, ids)
}

func (s *SysUserRoleService) DeleteByUserId(ctx context.Context, userId int64) (int64, error) {
	return s.repo.DeleteByUserId(ctx, userId)
}

func (s *SysUserRoleService) DeleteByUserIdList(ctx context.Context, ids []int64) (int64, error) {
	return s.repo.DeleteByUserIdList(ctx, ids)
}
